<script >
export default {
    name: "Aside",
    data() {
        return {
            manager: JSON.parse(sessionStorage.getItem("manager")),
            activeIndex: '1'
        }
    },
    methods: {
        handleSelect(index) {
            if (index === "1")
                this.$router.push("/managerMain")
            else if (index === "2-1")
                    if (this.manager.issuper)
                        this.$router.push("/ManagerData")
                    else {
                        this.$message({
                            message: '没有超级管理权限',
                            type: 'warning'
                        });
                    }
            else if (index === "2-2")
                this.$router.push("/userData")
            else if (index === "3")
                this.$router.push("/goodsData")
            else if (index === "4-1")
                this.$router.push("/orderData")
            else if (index === "4-2")
                this.$router.push("/unorderData")
            else if (index === "5")
                this.$router.push("/browseData")
        }
    }
}
</script>

<template>

    <el-menu default-active=activeIndex @select="handleSelect">

        <el-menu-item index="1">
            <i class="el-icon-menu"></i>首页</el-menu-item>

        <el-submenu index="2">
            <template slot="title"><i class="el-icon-user"></i>账户管理</template>
            <el-menu-item index="2-1"><i class="el-icon-s-management"></i>管理员账户</el-menu-item>
            <el-menu-item index="2-2"><i class="el-icon-s-custom"></i>用户账户</el-menu-item>
        </el-submenu>

        <el-menu-item index="3">
            <i class="el-icon-goods"></i>商品管理</el-menu-item>



        <el-submenu index="4">
            <template slot="title"><i class="el-icon-tickets"></i>订单管理</template>
                <el-menu-item index="4-1">订单日志</el-menu-item>
                <el-menu-item index="4-2">购物车日志</el-menu-item>
        </el-submenu>
        <el-menu-item index="5">
            <i class="el-icon-view"></i>浏览日志</el-menu-item>
    </el-menu>
</template>

<style scoped>

</style>